<%--
 *  File:    ApprovalSummaryOrganizationDT.jsp	
 *  @Author: Saraxia 
 *  Date:    2012/11/15
 *
 *  Copyright (C) 2000 - 2008 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  String privilegeCode = "11403";
  String strTableName = "";
  String strModuleName = "COM";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc"%>
<%@ include file="/inc/OvalLocationDefault.inc"%>
<%@ include file="/rpt/ReportURL.inc"%>

<html>
<head>
<title>ApprovalSummaryOrganizationDT</title>
<PageFlow:CheckPageFlow pageName="p_approvaltemporg113" />
<%@ include file="/inc/CatchError.inc"%>

<%
  Vector ugsummary = (Vector)pageContext.getAttribute("ugsummary");
  if(ugsummary == null) ugsummary = new Vector();
  
  String allflag = (String)pageContext.getAttribute("allflag");
  
  HashMap UserInfo = (HashMap)session.getAttribute("userinfo");
  if(UserInfo == null) UserInfo = new HashMap();
  
  Integer zylmdapprovaltype = (Integer)pageContext.getAttribute("zylmdapprovaltype");
%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<script type="text/javascript" src="<%=contextPath%>/js/opal2/mootools.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>

<script language="JavaScript">

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "ApprovalSummaryOrganizationDH.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var uploadorgids = document.getElementsByName('brandcodes');
	var length = uploadorgids.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
		if(!uploadorgids[i].disabled)
			uploadorgids[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			uploadorgids[i].checked = false;
		}	
	}
}


function editMode(obj,index,name,id) {
    if ($(name + index) == null) {
        var c = Trim(obj.innerText);
        var t = new Element('input', {
            'type':'text',
            'value':c,
            'styles':{
                    'width':'500px'
                     },
            'id':name + index,
            'name':name,
            'events':{
                'blur':function() {
                    saveData(this,id,c);
                },
                'keydown':function() {
                    if (event.keyCode == 13) {
                        saveData(this,id,c);
                    }
                }
            }
        });
       
        obj.innerHTML = '';
        t.inject(obj);
        selectText(t);
    }
}

function saveData(obj,id,c) {
    var p = obj.parentNode;
    p.innerHTML = obj.value;
    var req = new Request({
        'url':'<%=contextPath%>/Dispatcher',
        'method':'get',
        'data':'pagename=p_approvaltemporg113&actionname=save&columnname=' + obj.name + '&columnvalue='+ encodeURI(obj.value) + '&zylapprovaltemp_uploadorgid=' + id
    });
    req.send(); 
    window.location.reload();
}

//选中文本框中的字符

function selectText(obj) {
    var range = obj.createTextRange();
    range.moveStart("character", 0);
    range.select();
}


function page_refuse(){
	
    if(isNullChecked(cform.brandcodes))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	var alldatafile = document.getElementsByName('brandcodes');
	var length = alldatafile.length;
		for(var i=0;i<length;i++){
	      var j=i+1;
		  if(alldatafile[i].checked){
		    var approvalproposal=eval("document.cform.approvalproposal111"+j).value;
			if(approvalproposal=="")
			{
				alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_Approve",false)) %>");
		        return;
			}
		  }
		}
    
	document.cform.actionname.value = "refuse";
	document.cform.target = "_self";
    isRunning = true;
	document.cform.submit();
}

function page_agree(){
	
    if(isNullChecked(cform.brandcodes))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	document.cform.actionname.value = "agree";
	document.cform.target = "_self";
    isRunning = true;
	document.cform.submit();
}

function page_disagree(){
	
    if(isNullChecked(cform.brandcodes))
    {
        alert("<%= message.getMessageDesc("PLEASE_SELECT") %>");
        return;
    }

	var alldatafile = document.getElementsByName('brandcodes');
	var length = alldatafile.length;
		for(var i=0;i<length;i++){
	      var j=i+1;
		  if(alldatafile[i].checked){
		    var approvalproposal=eval("document.cform.approvalproposal111"+j).value;
			if(approvalproposal=="")
			{
				alert("<%= message.getMessageDesc("VALUE_NOT_NULL",label.getLabelName("L_Approve",false)) %>");
		        return;
			}
		  }
		}

	document.cform.actionname.value = "disagree";
	document.cform.target = "_self";
    isRunning = true;
	document.cform.submit();
}

function page_back(){
	var zylmdapprovaltype=cform.zylmdapprovaltype.value;
	self.location.href ="ApprovalFailOrganizationDHSummary.jsp?<%= OvalTools.randomURL() %>&zylmdapprovaltype="+zylmdapprovaltype+"&globalpccode=113";
}

</script>
</head>

<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher"><input
	type="hidden" name="pagename" value="p_approvaltemporg113"> 
	<input type="hidden" name="actionname"> 
	<input type="hidden" name="name"> 
	<input type="hidden" name="type"> 
	<input type="hidden" name="sheetname" value="hporginfo">
	<input type="hidden" name="flag" value="hporginfo">
    <input type="hidden" name="globalpccode" value="113"> 
    <input type="hidden" name="__header__Content-disposition" id="outname" value="attachment;filename=DistributorMasterData.xls" />
	<custom:hidden scope="session" name="userinfo" property="userid"></custom:hidden> 
    <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">
    <input type="hidden" name="zylmdapprovaltype" value="<%=zylmdapprovaltype %>">	
    
<%@ include file="/inc/PageLocation.inc"%>

	<table width="100%" cellspacing="0" cellpadding="0" border="0">
  	<tr> 
    	<td valign="top"> 
    		<table width="100%" border="0" cellspacing="0">
          	<tr><td class="summary_top" ></td></tr>
        	</table>
        </td>
   	</tr>
   	</table>
   	
	<div style="overflow:auto;width:1130;height:400">
		<table width="6400" border="1" cellpadding="0"
			bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0"
			align="center">
			<tr class="deepblue-left">
                <td class="title_center" rowspan="2" nowrap="nowrap"><input type="checkbox" name="allcheck" class="normalradio" onclick="allcheckselect();"></td>					
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_ApprovalStatus") %> </td>			  
              	<td class="title_center" rowspan="2" width="6%"><%= label.getLabelName("L_Approve") %> </td> 
				
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_HospitalCode1") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_YiLingCode") %></td>
				<td class="title_center" rowspan="2" width="4%"><%= label.getLabelName("L_CustomerName") %></td>
				<td class="title_center" rowspan="2" width="4%"><%= label.getLabelName("L_shortname") %></td>
				<td class="title_center" rowspan="2" width="1%"><%= label.getLabelName("L_StatusName") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_Province") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_City") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_CountyArea")+label.getLabelName("L_CustomerCode")%></td>
				<td class="title_center" rowspan="2" width="4%"><%= label.getLabelName("L_CountyArea")+label.getLabelName("L_CustomerName") %></td>
				<td class="title_center" rowspan="2" width="4%"><%= label.getLabelName("L_Address") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_ZipCode") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_Telephone") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_Fax") %></td>
				<td class="title_center" rowspan="2" width="4%"><%= label.getLabelName("L_Comments") %></td>

				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_HospitalType") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_Yl_Level") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_CountryLevel") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_IsBaseMedicineTerminal") %></td>

				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_QuickCode") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_ExInfo") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_ExInfo") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_ExInfo") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_ExInfo") %></td>
				<td class="title_center" rowspan="2" width="2%"><%= label.getLabelName("L_ExInfo") %></td>

				<td class="title_center" colspan="3"><%= label.getLabelName("L_Product")+label.getLabelName("L_GroupNo") %>1</td>
				<td class="title_center" colspan="3"><%= label.getLabelName("L_Product")+label.getLabelName("L_GroupNo") %>2</td>
				<td class="title_center" colspan="3"><%= label.getLabelName("L_Product")+label.getLabelName("L_GroupNo") %>3</td>
                <td class="title_center" colspan="3"><%= label.getLabelName("L_Product")+label.getLabelName("L_GroupNo") %>4</td>
                <td class="title_center" colspan="3"><%= label.getLabelName("L_Product")+label.getLabelName("L_GroupNo") %>5</td>
                <td class="title_center" colspan="3"><%= label.getLabelName("L_Product")+label.getLabelName("L_GroupNo") %>6</td>
                <td class="title_center" colspan="3"><%= label.getLabelName("L_Product")+label.getLabelName("L_GroupNo") %>7</td>
                <td class="title_center" colspan="3"><%= label.getLabelName("L_Product")+label.getLabelName("L_GroupNo") %>8</td>
                <td class="title_center" colspan="3"><%= label.getLabelName("L_Product")+label.getLabelName("L_GroupNo") %>9</td>
                <td class="title_center" colspan="3"><%= label.getLabelName("L_Product")+label.getLabelName("L_GroupNo") %>10</td>
               <!-- 
              	<td class="title_center" rowspan="2" width="1%"><%= label.getLabelName("L_Num") %> </td>
                --> 
				

			</tr>
			<tr class="deepblue-left">
				<td class="title_center"><%= label.getLabelName("L_Operation_Area") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepCode") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepName") %></td>

				<td class="title_center"><%= label.getLabelName("L_Operation_Area") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepCode") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepName") %></td>

				<td class="title_center"><%= label.getLabelName("L_Operation_Area") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepCode") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepName") %></td>
				
				<td class="title_center"><%= label.getLabelName("L_Operation_Area") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepCode") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepName") %></td>
				
				<td class="title_center"><%= label.getLabelName("L_Operation_Area") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepCode") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepName") %></td>
				
				<td class="title_center"><%= label.getLabelName("L_Operation_Area") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepCode") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepName") %></td>
				
				<td class="title_center"><%= label.getLabelName("L_Operation_Area") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepCode") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepName") %></td>
				
				<td class="title_center"><%= label.getLabelName("L_Operation_Area") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepCode") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepName") %></td>
				
				<td class="title_center"><%= label.getLabelName("L_Operation_Area") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepCode") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepName") %></td>
				
				<td class="title_center"><%= label.getLabelName("L_Operation_Area") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepCode") %></td>
				<td class="title_center"><%= label.getLabelName("L_SalesRepName") %></td>
			</tr>
			<%
	int i=0;
	String strClassType="";
	String checkflag = null;
    Integer ApprovalStatus = new Integer(-1); 
%>
			<span id="olddetail"> 
			
			<logic:iterate id="onerow" collection="<%= ugsummary %>" indexId="idx" scope="page">
				<%
	if(i%2 == 1)
	  {
	    strClassType = "td-listrom";
	  }else{                    
	    strClassType = "none";
	  }
	  i++;
	  
	  HashMap row = (HashMap)pageContext.getAttribute("onerow");
	  ApprovalStatus = (Integer)(row.get("approvalstatus"));
%>
				<tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'" class="<%=JspHelper.filterNull( strClassType )%>">
					<td><input type="checkbox" name="brandcodes" id="brandcodes<%=JspHelper.filterNull(i-1)%>" value="<custom:write name="onerow" property="zylapprovaltemp_uploadorgid"/>" class="normalradio" />
					</td>
					<input type="hidden"  name="approvalproposal111<%=i%>" value="<custom:write name="onerow" property="approvalproposal" />" />
					<td><a href="ApprovalFailRecordDetail.jsp?<%= OvalTools.randomURL() %>&zylapprovaltemp_uploadorgid=<custom:write name="onerow" property="zylapprovaltemp_uploadorgid"/>&zylmdapprovaltype=<%=zylmdapprovaltype%>"><custom:write property="statusname" name="onerow"  nbsp="true"/></a></td>
              		<td onclick="editMode(this,'<%=i%>','approvalproposal','<custom:write name="onerow" property="zylapprovaltemp_uploadorgid"/>');"><custom:write name="onerow" property="approvalproposal" nbsp="true" /></td>
					
					<td><custom:write property="orgcode" name="onerow" nbsp="true" /></td>
					<td><custom:write property="yl_orgcode" name="onerow" nbsp="true" /></td>
					<td><custom:write property="orgname" name="onerow" nbsp="true" /></td>
					<td><custom:write property="shortname" name="onerow" nbsp="true" /></td>
					<td><custom:write property="statusname" name="onerow" nbsp="true" /></td>
					<td><custom:write property="regionname" name="onerow" nbsp="true" /></td>
					<td><custom:write property="cityname" name="onerow" nbsp="true" /></td>
					<td><custom:write property="countyorgcode" name="onerow"
						nbsp="true" /></td>
					<td><custom:write property="countyorgname" name="onerow"
						nbsp="true" /></td>
					<td><custom:write property="registeraddress" name="onerow"
						nbsp="true" /></td>
					<td><custom:write property="zipcode" name="onerow" nbsp="true" /></td>
					<td><custom:write property="telephone" name="onerow" nbsp="true" /></td>
					<td><custom:write property="fax" name="onerow" nbsp="true" /></td>
					<td><custom:write property="comments" name="onerow" nbsp="true" /></td>

					<td><custom:write property="hospitaltype" name="onerow" nbsp="true" /></td>
					<td><custom:write property="yllevel" name="onerow" nbsp="true" /></td>
					<td><custom:write property="nationgrade" name="onerow" nbsp="true" /></td>
					<td><custom:write property="yesornodelivery" name="onerow"
						nbsp="true" /></td>
					<td><custom:write property="spellcn" name="onerow" nbsp="true" /></td>

					<td><custom:write property="attr101" name="onerow" nbsp="true" /></td>
					<td><custom:write property="attr102" name="onerow" nbsp="true" /></td>
					<td><custom:write property="attr103" name="onerow" nbsp="true" /></td>
					<td><custom:write property="attr104" name="onerow" nbsp="true" /></td>
					<td><custom:write property="attr105" name="onerow" nbsp="true" /></td>

					<td><custom:write property="area1" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactcode1" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactname1" name="onerow" nbsp="true" /></td>
					<td><custom:write property="area2" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactcode2" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactname2" name="onerow" nbsp="true" /></td>
					<td><custom:write property="area3" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactcode3" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactname3" name="onerow" nbsp="true" /></td>
                    <td><custom:write property="area4" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactcode4" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactname4" name="onerow" nbsp="true" /></td>
					<td><custom:write property="area5" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactcode5" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactname5" name="onerow" nbsp="true" /></td>
					<td><custom:write property="area6" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactcode6" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactname6" name="onerow" nbsp="true" /></td>
					<td><custom:write property="area7" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactcode7" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactname7" name="onerow" nbsp="true" /></td>
					<td><custom:write property="area8" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactcode8" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactname8" name="onerow" nbsp="true" /></td>
				    <td><custom:write property="area9" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactcode9" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactname9" name="onerow" nbsp="true" /></td>
					<td><custom:write property="area10" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactcode10" name="onerow" nbsp="true" /></td>
					<td><custom:write property="contactname10" name="onerow" nbsp="true" /></td>
					<!-- 
			  		<td><custom:write property="approvalno" name="onerow"  nbsp="true"/></td>
					 -->
              		
            </tr>

			</logic:iterate> </span>
			<tr>
				<td colspan="76" align="left"><%= label.getLabelName("L_TotalData") + label.getLabelName("L_Colon") %><custom:write
					property="count" name="count" nbsp="true" /></td>
			</tr>

			<%@ include file="/inc/SummaryActionUP.inc" %>
		</table>
		</div>
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="summary_top"></td></tr>
            <tr>
	        	<td class="td_center"> 
	        		<a onclick="page_agree()"><custom:button type="1" label="L_Agree" imgsrc="new.gif" border="0" style="width:60"/></a>
	        		<a onclick="page_disagree()"><custom:button type="1" label="L_NotAgree" imgsrc="edit.gif" border="0" style="width:60"/></a>
	        		<a onclick="page_refuse()"><custom:button type="1" label="L_Deny" imgsrc="delete.gif" border="0" style="width:60"/></a>
	        		<a onclick="page_back();"><custom:button type="1" label="L_Back" imgsrc="back.gif" border="0" style="width:60"/></a>        		
	        	</td>
            </tr>
          </table>
</form>
</body>
</html>